{extend name="common/main"/}

{block name="body"}
    <!-- 标题栏 -->
    <div class="main-title">
        <h2>{:lang("_PLUGIN_LIST_")}</h2>
    </div>
    <div class="with-padding">
    <div class="clearfix">
        <ul class="nav nav-pills pull-left">
            <li id="type_all"><a href="{:url('index',['type'=>'all'])}">{:lang("_ALL_")}</a></li>
            <li id="type_yes"><a href="{:url('index',['type'=>'yes'])}">{:lang("_INSTALLED_")}</a></li>
            <li id="type_no"><a href="{:url('index',['type'=>'no'])}">{:lang("_NOT_INSTALLED_")}</a></li>
            <script>
                $('#type_{$type}').addClass('active');
            </script>
        </ul>
        <div class="btn-group pull-right">
            <a class="btn btn-danger" href="{:url('hooks')}">{:lang("_HOOK_MANAGEMENT_")}</a>
        </div>
        </div>
        <div class="module-list cards clearfix">
            {notempty name="_list"}
            {volist name="_list" id="vo"}
            <div class="col-lg-3 col-md-4">
                <div class="module-list-box">
                    <div class="card">
                        <div class="media-wrapper">
                            {empty name="vo.id"}
                            <a href="#">
                            {else /}
                            <a href="{:url('config',['id'=>$vo['id']])}">
                            {/empty}
                            <div class="cover-icon">
                                <img src="{$vo.icon}" alt="{$vo['title']}"> 
                            </div>
                            </a>
                        </div>

                        <div class="content">
                            <div class="card-heading title">
                                <h3>{$vo.title} <small>{$vo.version}</small></h3>
                            </div>

                            <div class="card-content">
                                <p class="text-muted text-ellipsis">{$vo.description}</p>
                                <p class="text-muted text-ellipsis">{$vo.author}</p>
                            </div>
                            <div class="card-actions">
                                <div class="btn-group">
                                    {eq name="vo.is_setup" value="1"}
                                    {neq name="$vo.has_config" value="0"}
                                    <a class="btn btn-primary" href="{:url('config',array('id'=>$vo['id']))}">{:lang("_SET_UP_")}</a>
                                    {/neq}

                                    {eq name="vo.status" value="0"}
                                        <a class="btn btn-primary ajax-get" href="{:url('setStatus',array('id'=>$vo['id'],'status'=>'enable'))}">{:lang("_ENABLE_")}</a>
                                    {else/}
                                        <a class="btn btn-info ajax-get" href="{:url('setStatus',array('id'=>$vo['id'],'status'=>'disable'))}">{:lang("_DISABLE_")}</a>
                                    {/eq}
                                    <a class="btn btn-danger confirm ajax-get" href="{:url('uninstall?id='.$vo['id'])}">{:lang("_UNINSTALL_")}</a>
                                    {else/}
                                    <a class="btn btn-success ajax-get" href="{:url('install?addon_name='.$vo['name'])}">{:lang("_INSTALL_")}</a>
                                    {/eq}
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                </div>
            {/volist}
            {else/}
            <div class="text-center"> aOh!{:lang("_THERE_IS_NO_CONTENT_")}</div>
            {/notempty}
        </div>
    </div>


    <!-- 数据列表 -->
    <!-- 分页 -->
    <div class="page">
        {$page}
    </div>
{/block}
